
var addEvent = (function( window, document ) {
    if ( document.addEventListener ) {
        return function( elem, type, cb ) {
            if ( (elem && !elem.length) || elem === window ) {
                elem.addEventListener(type, cb, false );
            }
            else if ( elem && elem.length ) {
                var len = elem.length;
                for ( var i = 0; i < len; i++ ) {
                    addEvent( elem[i], type, cb );
                }
            }
        };
    } else if ( document.attachEvent ) {
        return function ( elem, type, cb ) {
            if ( (elem && !elem.length) || elem === window ) {
                elem.attachEvent( 'on' + type, function() { return cb.call(elem, window.event) } );
            } else if ( elem.length ) {
                var len = elem.length;
                for ( var i = 0; i < len; i++ ) {
                    addEvent( elem[i], type, cb );
                }
            }
        };
    }
})( this, document );

function getWindowSize(w, h) {

    var winW, h, sizes = {};

    if (document.body && document.body.offsetWidth) {
        winW = document.body.offsetWidth;
    }
    if (document.compatMode=='CSS1Compat' && document.documentElement && document.documentElement.offsetWidth ) {
        winW = document.documentElement.offsetWidth;
    }
    if (window.innerWidth && window.innerHeight) {
        winW = window.innerWidth;
    }

    h = parseFloat(w/h);
    h = isNaN(h) || !h ? 0 : h;

    sizes.w = winW > w ? w : (winW - 20);
    sizes.h = parseInt(sizes.w / h);
    return sizes;
}

function embedevplayer(Fid,w,h) {

    var sizes = getWindowSize(w,h);
    var frameName = 'wede2f34gt65651sdf5664asdad';

    addEvent(window, 'orientationchange', function () {
        var frame = document.getElementById(frameName);
        sizes = getWindowSize(w,h);
        frame.style.width = sizes.w + 'px';
        frame.style.height = sizes.h + 'px';
    });
    document.write('<iframe id="'+frameName+'" src="http://ero-video.net/blogframe/?' + Fid + '&width=' + sizes.w + '&height=' + sizes.h + '" style="width: '+ sizes.w +'px; height: '+ sizes.h +'px; border: none;" frameborder="no" scrolling="no"></iframe>');
}

Purauifla = embedevplayer;



